package com.gw.vip.server.config;

import com.gw.vip.common.util.Snowflake;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author GW
 * @description
 * @since 2022-04-16
 */
@Configuration
public class SnowflakeConfig {

    @Value("${snowflake.workId}")
    private Long workId;

    @Value("${snowflake.dataCenterId}")
    private Long dataCenterId;

    @Bean
    public Snowflake snowFlake(){
        return new Snowflake(workId, dataCenterId, 0L);
    }
}
